package com.pai4j.ugc.repository.dao;

import com.pai4j.ugc.repository.entity.MomentAiKeywordEntity;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface IMomentAiKeywordDAO extends JpaRepository<MomentAiKeywordEntity, Long> {
    List<MomentAiKeywordEntity> findByMomentId(Long momentId);

    @Modifying(clearAutomatically = true)
    @Transactional
    void deleteByMomentId(Long momentId);

    Page<MomentAiKeywordEntity> findByKeyword(String keyword, Pageable pageable);
}

